package util.exceptions;

import javax.swing.*;

/**
 * This exception is thrown if an equation is not valid.
 *
 * @author Donald Scott
 */
public class UnbalancableEquationException extends FOCException {

    /**
     * For serialization.
     */
    private static final long serialVersionUID = 2160693524275232387L;

    String reason;

    public UnbalancableEquationException(String c) {
        super(c);
        reason = c;

    }

    public UnbalancableEquationException() {
        super();
    }

    public final void showMessageDialog() {
        if (reason == null)
            showMessageDialog(
                    "That is not a valid equation!",
                    "Alert",
                    JOptionPane.WARNING_MESSAGE);
        else
            showMessageDialog(
                    reason,
                    "Alert",
                    JOptionPane.WARNING_MESSAGE);
    }

}
